<?php

use yii\db\Migration;

/**
 * Handles the creation of table `channel`.
 */
class m171111_031631_create_channel_table extends Migration
{
    /**
     * @inheritdoc
     */
    public function up()
    {
        $this->createTable('channel', [
            'id' => $this->primaryKey(),
            'utm' => $this->string(36)->comment('渠道参数')->notNull(),
            'note' => $this->string(36)->comment('渠道备注')->notNull(),

            //生成的model继承BaseModel，即可实现以下四个属性的自动更新
            'created_at' => $this->dateTime()->comment('创建时间'),
            'updated_at' => $this->dateTime()->comment('更新时间'),
            'created_by' => $this->integer()->comment('创建者'),
            'updated_by' => $this->integer()->comment('更新者'),
        ]);
    }

    /**
     * @inheritdoc
     */
    public function down()
    {
        $this->dropTable('channel');
    }
}
